<template>
	<view>
		
		<view class="cu-bar search bg-white">
		    <view class="search-form round">
		      <text class="cuIcon-search"></text>
		      <input type="text" placeholder="搜索我要的资源" v-model="content" confirm-type="search"></input>
		    </view>
		    <!-- <view class="action">
			  <text>搜索</text> -->
		      <!-- <text v-else>取消</text> -->
		    <!-- </view> -->
		  </view>
		<view class="zdnr">
			搜索指定内容
		</view>
		<view class="content-card">
			<view class="content-list" v-for="(item,index) in contentList" :key="index" @click="natoUrl(index)">
				<text>{{item.label}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	var app = getApp();
	export default {
		data() {
			return {
				content:"",
				contentList:[]
			};
		},
		onLoad() {
			this.getTypeList()
		},
		methods:{
			getTypeList(){
				app.get("ApiMingpian/serachtype",{},(res)=>{
					if(res.status == 1)
					this.contentList = res.data
					else{
						app.alert('查找出错请稍后再试')
					}
				})
			
			},
			natoUrlDefault(){
				if(this.content!="")
				uni.navigateTo({
					url:`./../acquainSearchDetail/acquainSearchDetail?type=0&conten=${this.content}`
				})
				else{
					uni.showToast({
						title:"请输入内容",
						icon:"none"
					})
				}
			},
			natoUrl(index){
				if(this.content!="")
				uni.navigateTo({
					url:`./../acquainSearchDetail/acquainSearchDetail?content=${this.content}&value=${this.contentList[index].serach_type}&text=${this.contentList[index].label}&type=1`
				})
				else{
					uni.showToast({
						title:"请输入内容",
						icon:"none"
					})
				}
			}
		}
	}
</script>

<style lang="less">
/* 输入框 */
.input-card{
	width: 100%;
	background-color: #FFFFFF;
	padding:20rpx 10rpx;
}
	.input {
		width: 94%;
		position: relative;
		display: flex;
		// top: 8%;
		height: 80rpx;
		left: 50%;
		transform: translateX(-50%);
		background-color: #f4f4f4;
		box-shadow: 0 0 4rpx 2rpx #FFF6F3;
		border-radius: 15rpx;

		.input-entry {
			width: 84%;
			height: 100%;

			input {
				width: 100%;
				height: 100%;
			}
		}

		.input-icon {
			width: 16%;
			height: 100%;
			display: flex;
			justify-content: center;
			align-items: center;

			image {
				width: 50%;
				height: 60%;
			}
		}
	}
	.zdnr{
		width: 100%;
		display: flex;
		align-items: center;
		height: 80rpx;
		justify-content: center;
		color: #afafaf;
		font-size: 36rpx;
	}
	.content-card{
		display: flex;
		flex-wrap: wrap;
		// justify-content: space-between;
		.content-list{
			width: 33.3%;
			margin: 1% 0;
			height: 80rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			text{
				font-size: 34rpx;
				color: #0301BC;
			}
		}
	}
</style>
